package by.dkusch.aircompany.dao;

import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import by.dkusch.aircompany.model.filter.base.FilterEntity;

public interface AbstractDao<ID, Entity> {

	Entity getById(ID id);

	List<Entity> getAll();

	void delete(ID key);

	void deleteAll();

	void delete(List<ID> ids);

	List<Entity> getAllByFieldRestriction(final SingularAttribute<? super Entity, ?> attribute, final Object value);

	List<Entity> getAllByFieldRestrictionAnyCase(final SingularAttribute<? super Entity, String> attribute, final String value);

	Entity insert(Entity entity);

	Entity update(Entity entity);

	List<Entity> getAllItems(SingularAttribute<? super Entity, ?> attr, boolean ascending, int startRecord, int pageSize);

	List<Entity> getAllItemsWithFilter(SingularAttribute<? super Entity, ?> attr, boolean ascending, int startRecord, int pageSize, FilterEntity<ID, ? super Entity> filter);

	Long getCount();

	Long getCountWithFilter(FilterEntity<ID, ? super Entity> filter);

	void saveList(List<Entity> records);

	boolean checkCanRemoveRecord(Entity entity);

}
